<template>
  <div class="inform" >
        <card  :footer="{title:'查看更多通知',link:'/center/notice'}" >
            <p v-for="(mess,index) in messagelist" slot="content" :key="index" class="card-padding" @click="messevent(index)">
              <span>【通知】</span><span>{{mess.title}}</span>
            </p>
        </card>
    </div>
</template>
<script>
import api from '../api'
import { Card } from 'vux'
export default {
  data () {
    return {
      messagelist: []
    }
  },
  components: {
    Card
  },
  created () {
    api.notice().then(res => {
      console.log(res)
      var notice = res.data.list
      this.messagelist = notice.slice(0, 3)
    })
  },
  methods: {
    // 公告
    messevent (index) {
      this.$router.push('/notice/detail?shareParam=share&notice_id=' + this.messagelist[index].id)
    }
  }
}
</script>

